package com.luoying.itew.http;

import com.luoying.itew.manage.UserManage;
import com.luoying.itew.util.AesUtil;
import com.luoying.itew.util.DateFormatUtils;

import java.util.Date;
import java.util.HashMap;

public class BaseMap extends HashMap<String, Object> {
    /**
     * token关键字
     */
    public static final String TOKEN = "access_token";
    /**
     * 鉴权关键字
     */
    public static final String SIGN = "sign";

    /**
     * 添加默认的参数
     */
    public BaseMap() {
        put(TOKEN, UserManage.getInstance().getUserToekn());
        String time = DateFormatUtils.format(new Date());
        String sign = AesUtil.byteArrayToHexString(AesUtil.encryptByAes(time));
        put(SIGN, sign);
    }

    public BaseMap put(String string, Object value) {
        super.put(string, value);
        return this;
    }
}
